﻿<?php if($sf_user->hasCredential("responsable")){?>
<h1>Bilan comptable</h1>

<div id="list">
	<table>
	  <thead>
	    <tr>
	      <th>Commande</th>
	      <th>Prix d'achat</th>
	      <th>Prix de vente</th>
	      <th>Chiffre d'affaire</th>
				<th>Détails</th>
	    </tr>
	  </thead>
	  <tbody>
	    <?php foreach ($commandes as $commande): 
	    	if($key % 2 == 0) {
	    		$style = "background-color: #A9CADD";
	    	} else {
	    		$style = "background-color: #E6F7FE";
	    	}	    
	    ?>
	    <tr style="<?php echo $style; ?>">
	      <!-- <td><a href="<?php echo url_for('commande/show?id='.$commande->getId()) ?>"><?php echo $commande->getId() ?></a></td> -->
	      <td><?php echo $commande ?></td>
	      <td><?php echo number_format($commande->getPa(), 2, ',', ' '); ?></td>
				<td><?php echo number_format($commande->getPv(), 2, ',', ' '); ?></td>
				<td><?php echo number_format($commande->getCa(), 2, ',', ' '); ?></td>
				<td><a href="<?php echo url_for('bilan/show?id='.$commande->getId()) ?>"><?php echo "Obtenir le détail" ?></a></td>
	    </tr>
	    <?php endforeach; ?>
	  </tbody>
	</table>
</div>
<?php	}else{
	echo "Droits insuffisants.";
} ?>